CoCaml: Functional Programming with Regular Coinductive Types

نویسندگان

  • Jean-Baptiste Jeannin
  • Dexter Kozen
  • Alexandra Silva
چکیده

Functional languages offer a high level of abstraction, which results in programs that are elegant and easy to understand. Central to the development of functional programming are inductive and coinductive types and associated programming constructs, such as pattern-matching. Whereas inductive types have a long tradition and are well supported in most languages, coinductive types are subject of more recent research and are less mainstream. We present CoCaml, a functional programming language extending OCaml, which allows us to define recursive functions on regular coinductive datatypes. These functions are defined like usual recursive functions, but parameterized by an equation solver. We present a full implementation of all the constructs and solvers and show how these can be used in a variety of examples, including operations on infinite lists, infinitary λ-terms, and p-adic numbers.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

CoCaml: Programming with Coinductive Types

We present CoCaml, a functional programming language extending OCaml, which allows us to define functions on coinductive datatypes parameterized by an equation solver. We provide numerous examples that attest to the usefulness of the new programming constructs, including operations on infinite lists, infinitary λ-terms and p-adic numbers. keywords: coalgebraic types, functional programming, rec...

متن کامل

Programming and Reasoning with Infinite Structures Using Copatterns and Sized Types

Inductive data such as lists and trees is modeled category-theoretically as algebra where construction is the primary concept and elimination is obtained by initiality. In a more practical setting, functions are programmed by pattern matching on inductive data. Dually, coinductive structures such as streams and processes are modeled as coalgebras where destruction (or transition) is primary and...

متن کامل

Non-Wellfounded Trees in Homotopy Type Theory

Coinductive data types are used in functional programming to represent infinite data structures. Examples include the ubiquitous data type of streams over a given base type, but also more sophisticated types. From a categorical perspective, coinductive types are characterized by a universal property, which specifies the object with that property uniquely in a suitable sense. More precisely, a c...

متن کامل

On sound and complete axiomatization of coinductive subtyping for object-oriented languages

Coinductive abstract compilation is a novel technique, which has been recently introduced for defining precise type systems for objectoriented languages. In this approach, type inference consists in translating the program to be analyzed into a Horn formula f , and in resolving a certain goal w.r.t. the coinductive (that is, the greatest) Herbrand model of f . Type systems defined in this way a...

متن کامل

Infinitary Rewriting Coinductively

We provide a coinductive definition of strongly convergent reductions between infinite lambda terms. This approach avoids the notions of ordinals and metric convergence which have appeared in the earlier definitions of the concept. As an illustration, we prove the existence part of the infinitary standardization theorem. The proof is fully formalized in Coq using coinductive types. The paper co...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Fundam. Inform.

دوره 150  شماره 

صفحات  -

تاریخ انتشار 2017